import request from '@/utils/request'

// 查询数据库连接列表
export function listConn(query) {
  return request({
    url: '/db/conn/list',
    method: 'get',
    params: query
  })
}

// 查询数据库连接详细
export function getConn(id) {
  return request({
    url: '/db/conn/' + id,
    method: 'get'
  })
}

// 新增数据库连接
export function addConn(data) {
  return request({
    url: '/db/conn',
    method: 'post',
    data: data
  })
}

// 修改数据库连接
export function updateConn(data) {
  return request({
    url: '/db/conn',
    method: 'put',
    data: data
  })
}

// 删除数据库连接
export function delConn(id) {
  return request({
    url: '/db/conn/' + id,
    method: 'delete'
  })
}

//测试连接
export function testConn(data){
  return request({
    url: '/db/conn/testconn',
    method: 'post',
    data: data
  })
}

export function getTableList(connName){
  return request({
    url: '/db/conn/getTableList',
    method: 'post',
    params: connName,
  })
}

export function recovery(data){
  return request({
    url: '/db/conn/recovery',
    method: 'post',
    data: data
  })
}

export function recoveryLastRowLog(query){
  return request({
    url: '/db/conn/recoveryLastRowLog',
    method: 'get', 
    params: query
  })
}